package com.example.element.module.jetpack.workmanager

import android.content.Context
import androidx.work.Worker
import androidx.work.WorkerParameters
import com.example.common.utils.L

class SimpleWorker(context: Context, workerParams: WorkerParameters) : Worker(context, workerParams) {

    private val TAG = "SimpleWorker"

    /**
     * doWork不会运行在主线程中
     * return result:成功返回Result.success()，失败返回Result.failure()，Result.retry()方法，它其实也代表着失败，
     * 只是可以结合WorkRequest.Builder的setBackoffCriteria()方法来重新执行任务
     */
    override fun doWork(): Result {
        L.e(TAG, "do work in simpleWork")
        return Result.success()
    }

}